


export function success (that, msg) {
  that.$message({
    type: 'success',
    message: msg
  });
}
export function error (that, msg) {
  that.$message.error(msg);
}

export function yesOrNo (that, msg, onOk, onCancel) {
  that.$confirm(msg, '提示', {
    confirmButtonText: '确定',
    cancelButtonText: '取消',
    type: 'warning'
  }).then(() => {
    onOk()
  }).catch(() => {
    if (onCancel != null) {
      onCancel()
    }
  });
}

export function inputDialog (that, title, info, onOk, onCancel) {
  that.$prompt(info, title, {
    confirmButtonText: '确定',
    cancelButtonText: '取消',
    closeOnClickModal: false

  }).then(({ value }) => {
    onOk(value)

  }).catch(() => {
    onCancel()
  });

}